Introduction to Python (tutorial)

Excerpts from:

A Crash Course in Python for Scientists

Rick Muller, Sandia National Laboratories

http://nbviewer.ipython.org/gist/rpmuller/5920182

[Run throught the tutorial]

Basic Python Data Structures


In [6]:
2+3


Out[6]:
5

In [2]:
import math
math.sqrt(1)


Out[2]:
1.0

In [4]:
a = dict({'key': 1, 'luca': 'ciao'})

In [5]:
a['luca']


Out[5]:
'ciao'

In [11]:
'b' in ['a','a','v']


Out[11]:
False

In [12]:
('a','b')


Out[12]:
('a', 'b')

Tuples, Lists, Dicts


In [ ]:

Containers


In [ ]: